package com.example.apiordernacosseata.controller;

import com.example.apiordernacosseata.mapper.OrderMapper;
import com.wu.common.entity.ResultData;
import io.seata.core.context.RootContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author whx
 * @date 2022/3/12
 */
@RestController
@RequestMapping("order")
public class OrderController {

    @Autowired
    OrderMapper orderMapper;

    @PostMapping("/update")
//    @Transactional
    public ResultData update(int id){
        System.out.println("xid: "+RootContext.getXID());
        orderMapper.update(id);
        int i = 1/0;
        return new ResultData().SUCCESS("success");
    }

}
